package com.kangfu.api.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.kangfu.common.annotation.IgnoreAuth;
import com.kangfu.common.model.AjaxResult;
import com.kangfu.db.model.vo.UserMenuVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/userMenu")
public class UserMenuController {

    @GetMapping("/list")
    @IgnoreAuth
    public AjaxResult list() throws JsonProcessingException {
//        String jsonStr = "[{\"path\":\"/pages/list/course\",\"imageSrc\":\"../../static/images/chufang.png\",\"text\":\"运动处方\"},{\"path\":\"navigatorCheckIn\",\"imageSrc\":\"../../static/images/yundong.png\",\"text\":\"运动打卡\"},{\"path\":\"/pages/list/pills-list\",\"imageSrc\":\"../../static/images/dakai.png\",\"text\":\"服药打卡\"},{\"path\":\"/pages/business/vacation\",\"imageSrc\":\"../../static/images/xiuxi.png\",\"text\":\"请假休息\"},{\"path\":\"/pages/user/order\",\"imageSrc\":\"../../static/images/dingdang.png\",\"text\":\"我的订单\"},{\"path\":\"/pages/user/address/list\",\"imageSrc\":\"../../static/images/dizhi.png\",\"text\":\"收货地址\"},{\"path\":\"/pages/user/question\",\"imageSrc\":\"../../static/images/wenjuan.png\",\"text\":\"我的问卷\"},{\"path\":\"/pages/business/opinion\",\"imageSrc\":\"../../static/images/jianyi.png\",\"text\":\"意见反馈\"},{\"path\":\"/pages/setting/index\",\"imageSrc\":\"../../static/images/shezhi.png\",\"text\":\"设置\"}]";
        String jsonStr = "[{\"path\":\"/pages/list/course\",\"imageSrc\":\"../../static/images/chufang.png\",\"text\":\"运动处方\"},{\"path\":\"navigatorCheckIn\",\"imageSrc\":\"../../static/images/yundong.png\",\"text\":\"运动打卡\"},{\"path\":\"/pages/business/vacation\",\"imageSrc\":\"../../static/images/xiuxi.png\",\"text\":\"请假休息\"},{\"path\":\"/pages/user/order\",\"imageSrc\":\"../../static/images/dingdang.png\",\"text\":\"我的订单\"},{\"path\":\"/pages/user/address/list\",\"imageSrc\":\"../../static/images/dizhi.png\",\"text\":\"收货地址\"},{\"path\":\"/pages/user/question\",\"imageSrc\":\"../../static/images/wenjuan.png\",\"text\":\"我的问卷\"},{\"path\":\"/pages/business/opinion\",\"imageSrc\":\"../../static/images/jianyi.png\",\"text\":\"意见反馈\"},{\"path\":\"/pages/setting/index\",\"imageSrc\":\"../../static/images/shezhi.png\",\"text\":\"设置\"}]";
//        String jsonStr = "[{\"path\":\"/pages/list/course\",\"imageSrc\":\"../../static/images/chufang.png\",\"text\":\"运动处方\"},{\"path\":\"navigatorCheckIn\",\"imageSrc\":\"../../static/images/yundong.png\",\"text\":\"运动打卡\"},{\"path\":\"/pages/business/vacation\",\"imageSrc\":\"../../static/images/xiuxi.png\",\"text\":\"请假休息\"},{\"path\":\"/pages/user/order\",\"imageSrc\":\"../../static/images/dingdang.png\",\"text\":\"我的订单\"},{\"path\":\"/pages/user/address/list\",\"imageSrc\":\"../../static/images/dizhi.png\",\"text\":\"收货地址\"},{\"path\":\"/pages/business/opinion\",\"imageSrc\":\"../../static/images/jianyi.png\",\"text\":\"意见反馈\"},{\"path\":\"/pages/setting/index\",\"imageSrc\":\"../../static/images/shezhi.png\",\"text\":\"设置\"}]";
        ObjectMapper objectMapper = new ObjectMapper();

        List<UserMenuVo> userMenuVoList = objectMapper.readValue(jsonStr, new TypeReference<List<UserMenuVo>>(){});
        return AjaxResult.success(userMenuVoList);
    }


}
